import Vue from 'vue'
import VueRouter from 'vue-router'
// 一级 ->layout
import Layout from '@/views/layout.vue'
// 二级 ->layout=>
import Home from '@/views/layout_2级/home.vue'
import Find from '@/views/layout_2级/find.vue'
import Message from '@/views/layout_2级/message.vue'
import User from '@/views/layout_2级/user.vue'
// 一级 ->citylist
import CityList from '@/views/city-list.vue'
// 地图
const Map = () => import('@/views/map.vue')
// 房屋详情页
const House = () => import('@/views/house.vue')
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      { path: 'home', component: Home },
      { path: 'find', component: Find },
      { path: 'message', component: Message },
      { path: 'user', component: User }
    ]
  },
  {
    path: '/citylist',
    component: CityList
  },
  { path: '/map', component: Map },
  { path: '/house', component: House }
]

const router = new VueRouter({
  routes
})

export default router
